/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#ifndef INCLUDE_BASIC_DEF
#define INCLUDE_BASIC_DEF

#include <cstdint>
#include "basic_typedef.h"



//#define DEF_HF32			1.701411733e+38
//#define INT最小值			-2147483648
//#define INT最大值			2147483647

#define DEF_浮点精度补充	1.0e-8



enum E_基本数值类型 {
	e_Any,

	e_浮点数32Bit,
	e_浮点数64Bit,

	e_有符号整数8Bit,
	e_有符号整数16Bit,
	e_有符号整数32Bit,
	e_有符号整数64Bit,

	e_无符号整数8Bit,
	e_无符号整数16Bit,
	e_无符号整数32Bit,
	e_无符号整数64Bit,
};


#define cpp友员		friend


enum E_计算类型 {
	e_OpenCL, e_CUDA
};

enum E_绘制后端 {
	E_绘制后端_VULKAN,
	E_绘制后端_CPU,
	E_绘制后端_CUDA,
	E_绘制后端_OpenCL,
	E_绘制后端_GLSL,
	e_绘制后端_GL,
	e_NanoVG
};
enum E_并行设备 { e_CPU并行, e_CUDA并行, e_OpenCL并行, e_GLSL并行 };

typedef enum : uint8 {
	e_纵向 = 0, e_横向 = 1,

	e_头 = 0,
	e_尾 = 1,

	e_左 = 2,
	e_右 = 3,
	e_上 = 4,
	e_下 = 5,
	e_Dir_前,
	e_Dir_后,

	
	e_中,

	e_左上,
	e_左下,
	e_右上,
	e_右下,
}E_方向;

typedef enum : uint32 {
	e_横向位域 = 1 << 0,
	e_纵向位域 = 1 << 1,
}E_方向位域;



/*class C_Object;
typedef void(C_Object::* t_on_函数指针_nil)();
class C_Object {
public:
	t_on_函数指针_nil fun;
};*/

typedef enum : uint8 {
	e_一维 = 1, e_二维 = 2, e_三维 = 3
}E_维度;

typedef enum : uint32 {
	e_XYZ = 0, 

	e_X = 1 << 0, 
	e_Y = 1 << 1, 
	e_Z = 1 << 2,

	e_XY = 1 << 3,
	e_XZ = 1 << 4,
	e_YZ = 1 << 5,

	e_None轴向,
}E_轴向;

typedef enum : uint32 {
	e_变换_None, e_移动 = 1, e_旋转 = 2, e_缩放 = 3,
}E_变换;


typedef enum : uint8 {
	e_0Bit = 0,
	e_8Bit = 1,
	e_16Bit = 2,
	e_32bi = 4,
	e_64bi = 8,

	e_8bit_3 = 3,
	e_16bit_3 = 6,
	e_32bit_3 = 12,
	e_64bit_3 = 24,
}E_位宽;

typedef struct __p_Struct	S_结构对象, *S_结构指针;



#define DEF_Max(a,b) (((a) > (b)) ? (a) : (b))
#define DEF_Min(a,b) (((a) < (b)) ? (a) : (b))

#define Sian( genType ) (((genType) >= (0)) ? (1.0) : (-1.0))
#define f_Decimal( genType ) ( (genType) - int32( (genType) ) )
#define f_Decimal正( genType ) ( 1.0 + ((genType) - int32( (genType) )) )

#define Inline __forceinline 


#define CORE_ARRAY_HANDLE(object, TYPE) typedef struct { TYPE* ptr_userData; uint64 count; } object;
//#define CORE_ARRAY_FUNC(NAME, TYPE) \
//	typedef f_core_array_resize f_array_resize##NAME;

#define DEF_字符串拼接ID(a, b, c, d, e, f, g, h) (uint64(a)<<0) | (uint64(b)<<8) | (uint64(c)<<16) | (uint64(d)<<24) | (uint64(e)<<32) | (uint64(f)<<40) | (uint64(g)<<48) | (uint64(h)<<56)




enum E_值类型 : uint64 {
	e_Type_None,
	e_Type_Operator,
	e_Type_Enum,
	e_Type_UI8_FlagBits,
	e_Type_UI16_FlagBits,
	e_Type_UI32_FlagBits,
	e_Type_UI64_FlagBits,
	e_Type_UI128_FlagBits,

	//单值
	e_Type_Str,

	e_Type_Bool,
	e_Type_LineText,
	e_Type_F16,
	e_Type_F32,
	e_Type_F64,
	e_Type_F128,

	e_Type_I8,
	e_Type_I16,
	e_Type_I32,
	e_Type_I64,
	e_Type_I128,
	e_Type_UI4,
	e_Type_UI8,
	e_Type_UI16,
	e_Type_UI32,
	e_Type_UI64,
	e_Type_UI128,




	//矢量
	e_Type_Vec2,
	e_Type_Vec3,
	e_Type_Vec4,

	e_Type_iVec2,
	e_Type_uVec2,
	e_Type_iVec3,
	e_Type_uVec3,
	e_Type_iVec4,
	e_Type_uVec4,

	e_Type_RGBA8,
	e_Type_RGBA16,
	e_Type_RGBA32,
	e_Type_Quat,


	e_Type_Str_1D,
	e_Type_Bool_Array1D,
	e_Type_F32_Array1D,
	e_Type_F32_1D,
	e_Type_F32_Range,
	e_Type_F64_1D,
	e_Type_I8_1D,
	e_Type_I32_1D,
	e_Type_I64_Array1D,
	e_Type_UI8_Array1D,
	e_Type_UI32_1D,
	e_Type_Vec2_Array1D,
	//c++ 类型
	e_Type_Vec3_Array1D,
	e_Type_Vec4_Array1D,
	e_Type_Quat_Array1D,

	//内置类型
	e_Type_Vec3_1D,
	e_Type_Vec4_1D,

	e_Type_Index_F32_1D,
	e_Type_Index_Vec3_1D,

	//矩阵
	e_Type_Mat2X2,
	e_Type_Mat3X3,
	e_Type_Mat4X4,

	//曲线
	e_Type_2D曲线采样,
	e_Type_2D曲线采样1D,
	e_Type_2D曲线,
	e_Type_2D曲线1D,



	//场景物体
	e_Type_Mesh,
	e_Type_Object,
	e_Type_Object_1D,

	e_Type_ObjectData,
	//e_插座Type_BlMesh,
	//e_插座Type_Particles,
	e_Type_ParticleSystem,
	e_Type_Scene,
	e_Type_集合,
	e_Type_体素,

	e_Type_多边形,
	e_Type_多边形_1D,
	e_Type_多边形边,
	e_Type_多边形边1D,
	e_Type_多边形面,
	e_Type_多边形面1D,
		e_Type_多边形元素,
		e_Type_多边形元素1D,
	e_Type_面顶点索引,

	e_Type_RGB,
	e_Type_RGBA,

	e_Type_材质,
	e_Type_材质1D,
	e_Type_图像,
	e_Type_纹理,
	e_Type_纹理_1D,

	e_Type_GPU缓存1D,



	//物理物体
	e_Type_车轮,
	e_Type_车辆,
	e_Type_发射,
	e_插座Type_物理材质,
	e_插座Type_物理几何,
	e_插座Type_物理体,
	e_插座Type_物理平面,
	e_插座Type_bl物体朝向,


	//-----------------------------
	//e_插座Type_Vector模板,
	//e_插座Type_Array元素,
	e_插座Type_引用数据,
	e_插座Type_调试信息,
	e_插座Type_动态转换,



	e_插座Type_ArrayBegin,

	//以上数据序列数据-----------------------------------------------------------------------


	e_插座Type_Str_2D,
	e_插座Type_Str_3D,
	e_插座Type_Str_4D,


	e_插座Type_Array2D_Bool,
	e_插座Type_Array3D_Bool,
	

		e_Type_Bool_1D,
		e_插座Type_I8_Array2D,
		e_插座Type_I8_Array4D,



	e_插座Type_Vec2_Array2D,
	e_插座Type_Vec2_Array3D,
	e_Type_Vec2_1D,
		e_Type_iVec2_1D,
		e_Type_iVec3_1D,


	e_Type_uVec2_1D,
	e_Type_uVec3_1D,
	e_插座Type_Vec3_Array4D,

	e_Type_UI32_2D,
	e_插座Type_uVec3_Array2D,
	e_插座Type_uVec3_Array3D,
	e_插座Type_uVec3_Array4D,


	e_插座Type_Vec4_Array2D,
	e_插座Type_Vec4_Array3D,
	e_插座Type_Vec4_Array4D,

	
	e_插座Type_Vec2i_Array2D,
	e_过程纹理,
	e_过程纹理_1D,

	e_插座Type_Vec3i_Array1D,
	e_插座Type_Vec3i_Array2D,
	e_插座Type_Vec3i_Array3D,
	e_Type_Shader,

		e_Type_Array,
		e_Type_Array1D,
		e_Type_Array元素,
	e_Type_TexProp,




	e_插座Type_Rect32f,
	e_插座Type_Rect32f_Array1D,
	e_Type_Cube_Array1D,
	e_插座Type_Vec球,
	e_Type_VecSphere_1D,
	e_Type_Bounding,
	e_Type_Bounding_Array1D,



	e_插座Type_Line,
	e_插座Type_Line_Array1D,

	e_Type_VN,
	e_Type_VN_Array1D,

	//矩阵
	e_插座Type_Mat2X2_Array1D,
	e_插座Type_Mat3X3_Array1D,
	e_Type_Mat4X4_Array1D,
	e_Type_Mat4X4_1D,
	e_插座Type_Mat4X4_Array3D,
	e_插座Type_Mat4X4_Array4D,

	e_插座Type_MapiVec3_Uint32_Array1D,
	e_插座Type_MapiVec3_Uint32_Array2D,
	e_插座Type_Uint64Map_Uint32_Array2D,

	e_Type_Tranform_Array1D,




	e_Type_Mesh_1D,
	e_插座Type_Mesh_Array2D,

	e_Type_元素选择,
	e_Type_元素选择1D,
	

	e_插座Type_根对象_1D,


	e_插座Type_ObjectData_Array1D,

	e_Type_骨架,
	e_Type_骨架_Array1D,
	e_Type_骨骼,
	e_Type_骨骼_Array1D,

	e_Type_IK,
	e_Type_IK_Array1D,



		e_Type_Object_Array1D,
		e_插座Type_F32_Array2D,
		e_插座Type_F32_Array3D,
		e_插座Type_Array4D_F32,
		e_插座Type_I32_Array2D,
		e_插座Type_I32_Array3D,
		e_插座Type_I32_Array4D,
		e_插座Type_UI32_Array2D,
		e_插座Type_UI32_Array3D,
		e_插座Type_UI32_Array4D,
		e_插座Type_I64_Array2D,
		e_插座Type_I64_Array3D,
		e_插座Type_I64_Array4D,
		e_插座Type_UI64_Array1D,



	//e_插座Type_VectorLine,
	e_插座Type_VectorParticle,
	e_插座Type_VectorScene,
	e_插座Type_字体_1D,


	//物理物体
	e_插座Type_物理解算器,

	e_插座Type_车轮_Array1D,
	e_插座Type_车辆_Array1D,
	e_插座Type_物理材质_Array1D,
	e_插座Type_物理几何_Array1D,
	e_插座Type_物理体_Array1D,
	e_插座Type_物理平面_Array1D,
	e_插座Type_材质_Array1D,

	
	e_插座Type_通用取,



	e_插座Type_八叉树,
	e_插座Type_树路径,


	e_Type_Mesh_点,
	e_Type_Mesh_线,
	e_Type_Mesh_面中心,

	e_Type_Mesh_点1D,
	e_Type_Mesh_线1D,
	e_Type_Mesh_面中心1D,


		e_Type_Node,
		e_Type_Widget,

	e_Type_路径,
	e_Type_MapPtr,
	e_Type_MapPtr_Array1D,
	e_Type_PropContainer,
	e_Type_PropList,

	e_Type_LayoutBegin,
	e_Type_LayoutList,
	e_Type_LayoutMesh,
	e_Type_LayoutTypeEdit,
	e_Type_LayoutEnd,

		e_Type_I32_2D = DEF_字符串拼接ID('i', '3', '2', '2', 'D', '\0', '\0', '\0'),
		e_Type_Vec3_2D = DEF_字符串拼接ID('V', 'e', 'c', '3', '2', 'D', '\0', '\0'),
		e_Type_iVec4_1D = DEF_字符串拼接ID('i', 'V', 'e', 'c', '4', '1', 'D', '\0'),
		e_Type_iVec3_2D = DEF_字符串拼接ID('i', 'V', 'e', 'c', '3', '2', 'D', '\0'),
		e_Type_uVec4_1D = DEF_字符串拼接ID('u', 'V', '4', '1', 'd', '\0', '\0', '\0'),
		e_Type_Bounding_1D = DEF_字符串拼接ID('B', 'o', 'u', 'n', 'd', '\0', '\0', '\0'),
		e_Type_i8体素 = DEF_字符串拼接ID('V', 'o', 'x', 'e', 'l', 'i', '8', '\0'),


		e_Type_映射引用_2D = DEF_字符串拼接ID('Y', 'S', 'Y', 'Y', '2', 'D', '\0', '\0'),
		e_Type_键位映射 = DEF_字符串拼接ID('K', 'e', 'y', 'M', 'a', 'p', '\0', '\0'),
		e_Type_字体 = DEF_字符串拼接ID('F', 'o', 'n', 't', '\0', '\0', '\0', '\0'),

		e_Type_网格自定义属性 = DEF_字符串拼接ID('W', 'G', 'Z', 'D', 'Y', 'S', 'X', '\0'),
		e_Type_实例自定义属性 = DEF_字符串拼接ID('S', 'L', 'Z', 'D', 'Y', 'S', 'X', '\0'),

		e_Type_UI8位域枚举 = DEF_字符串拼接ID('F', 'B', 'E', 'n', 'u', 'm', '1', '\0'),
		e_Type_UI16位域枚举 = DEF_字符串拼接ID('F', 'B', 'E', 'n', 'u', 'm', '2', '\0'),
		e_Type_UI32位域枚举 = DEF_字符串拼接ID('F', 'B', 'E', 'n', 'u', 'm', '4', '\0'),
		e_Type_UI64位域枚举 = DEF_字符串拼接ID('F', 'B', 'E', 'n', 'u', 'm', '8', '\0'),
		e_Type_UI128位域枚举 = DEF_字符串拼接ID('F', 'B', 'E', 'n', 'u', 'm', '1', '6'),

		e_Type_UI32Ops = DEF_字符串拼接ID('M', 'O', 'p', 's', '\0', '\0', '\0', '\0'),
		e_Type_ArrayRef = DEF_字符串拼接ID('A', 'R', 'e', 'f', '\0', '\0', '\0', '\0'),

		e_Type_LineStr1D = DEF_字符串拼接ID('L', 'S', '1', 'D', '\0', '\0', '\0', '\0'),
		
		
		e_Type_LigthParallel = DEF_字符串拼接ID('L', 'P', 'a', 'r', 'a', 'l', '\0', '\0'),
		e_Type_LigthPoint = DEF_字符串拼接ID('L', 'P', 'o', 'i', 'n', 't', '\0', '\0'),
		e_Type_LigthArea = DEF_字符串拼接ID('L', 'A', 'r', 'e', 'a', '\0', '\0', '\0'),
		e_Type_LigthSpot = DEF_字符串拼接ID('L', 'S', 'p', 'o', 't', '\0', '\0', '\0'),

		e_Type_SocketContainer = DEF_字符串拼接ID('S', 'o', 'c', 'k', 'C', 'o', 'n', 't'),
		e_Type_ContainerBool = DEF_字符串拼接ID('C', 'o', 'n', 't', 'B', 'o', 'o', 'l'),
		e_Type_ContainerF32 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'F', '3', '2', '\0'),
		e_Type_ContainerI8 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'I', '8', '\0', '\0'),
		e_Type_ContainerI32 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'I', '3', '2', '\0'),
		e_Type_ContainerUI32 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'U', 'I', '3', '2'),
		e_Type_ContainerVec2 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'V', '2', '\0', '\0'),
		e_Type_ContainerVec3 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'V', '3', '\0', '\0'),
		e_Type_ContainerVec4 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'V', '4', '\0', '\0'),
		e_Type_ContaineriVec2 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'i', 'V', '2', '\0'),
		e_Type_ContaineriVec3 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'i', 'V', '3', '\0'),
		e_Type_ContaineriVec4 = DEF_字符串拼接ID('C', 'o', 'n', 't', 'i', 'V', '4', '\0'),
		e_Type_ContainerBound = DEF_字符串拼接ID('C', 'o', 'n', 't', 'B', 'o', 'u', 'n'),
		e_Type_ContainerValue = DEF_字符串拼接ID('C', 'o', 'n', 't', 'V', 'a', 'l', '\0'),

		e_Type_网格元素索引 = DEF_字符串拼接ID('M', 'e', 'E', 'I', '\0', '\0', '\0', '\0'),

		e_Type_颜色 = DEF_字符串拼接ID('c', 'o', 'l', '\0', '\0', '\0', '\0', '\0'),
		e_Type_Curve3D = DEF_字符串拼接ID('c', 'u', 'r', 'v', 'e', '3', 'd', '\0'),
		e_Type_TexSets = DEF_字符串拼接ID('t', 'e', 'x', 's', 'e', 't', 's', '\0'),

		e_Type_ObjectContainerMap = DEF_字符串拼接ID('R', 'Q', 'o', 'b', '\0', '\0', '\0', '\0'),
		e_Type_ObjectContainerArray = DEF_字符串拼接ID('o', 'b', 'a', 'r', 'r', 'a', 'y', '\0'),

		e_Type_ObjectOps = DEF_字符串拼接ID('o', 'b', 'c', 'a', 'l', 'l', '\0', '\0'),

		e_Type_轨道容器 = DEF_字符串拼接ID('t', 'r', 'c', 'k', 'R', 'Q', '\0', '\0'),
		e_Type_自定义结构 = DEF_字符串拼接ID('Z', 'D', 'Y', 'J', 'G', '\0', '\0', '\0'),
	e_Type_End,
};


#define _E_JIT_FunParam	\
typedef struct {		\
	void*		m_data;	\
	uint64		m_Num;	\
	E_值类型	m_type;	\
}E_JIT_FunParam;		\


_E_JIT_FunParam



typedef enum {
	e_jit_None,
	e_jit_llvm,
	e_jit_dll,
	e_jit_js,
}E_JIT方式;



typedef enum {
	e_MS_1 = 1,
	e_MS_2 = 2,
	e_MS_4 = 4,
	e_MS_8 = 8,
	e_MS_16 = 16,
	e_MS_32 = 32,
	e_MS_64 = 64,
}E_MS次数;



typedef enum {
	e_tf_R8,
	e_tf_RG8,
	e_tf_RGB8,
	e_tf_RGBA8,

	e_tf_R16,
	e_tf_RG16,
	e_tf_RGB16,
	e_tf_RGBA16,

	e_tf_R32,
	e_tf_RG32,
	e_tf_RGB32,
	e_tf_RGBA32,


	e_tf_R8U,
	e_tf_RG8U,
	e_tf_RGB8U,
	e_tf_RGBA8U,

	e_tf_R8U_归一化,
	e_tf_RG8U_归一化,
	e_tf_RGB8U_归一化,
	e_tf_RGBA8U_归一化,

	e_tf_R16U,
	e_tf_RG16U,
	e_tf_RGB16U,
	e_tf_RGBA16U,

	e_tf_R32U,
	e_tf_RG32U,
	e_tf_RGB32U,
	e_tf_RGBA32U,

	e_tf_R32U_U,
	e_tf_RG32U_U,
	e_tf_RGB32U_U,
	e_tf_RGBA32U_U,


	e_tf_深度纹理,

	e_tf_D16,
	e_tf_D24,
	e_tf_D32,
	e_tf_D64,
	e_tf_D32F,
}E_纹理格式;

enum E_纹理维度类型 : uint32 {
	e_1D,
	e_2D,
	e_3D,

	e_1D_Array,
	e_2D_Array,
	//e_3D_Array,
	e_CUBE,
	e_CUBE_Array,
};

enum E_纹理排列 : uint32 {
	e_瓦片 = 0,
	e_线性 = 1,
	e_DRM_FORMAT_MODIFIER = 2,
	e_BEGIN_RANGE = 3,
	e_END_RANGE = 4,
	e_RANGE_SIZE = 5,
	e_MAX_ENUM = 6,
};




typedef struct {
	uint64 m_偏移;
	uint64 m_数量;
} S_GPU偏移大小;

typedef struct {
	struct S_板载缓存* m_Buf;
	S_GPU偏移大小      m_Mem;
	void* m_Acc;
	void* m_As;
}S_GPU内存块;


typedef struct {
	E_值类型	m_Type;
	S_结构指针	m_Value;
}S_属性;


#endif //INCLUDE_BASIC_DEF


 